<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    

<script>

    const name = 'kele';
    const age = 20;
    const height = 1.80;

    // ES5的写法
    const obj1 = {
        name: name,
        age: age,
        height: height
    }
    console.log(obj1);

    // ES6的写法
    const obj2 = {
        name,
        age,
        height
    }
    console.log(obj2);


    // 函数的增强写法
    // ES5的写法
    const obj3 = {
        run: function(){
            console.log('obj3run');
        },
        eat: function(){
            console.log('obj3eat');
        }
    }
    obj3.eat();
    obj3.run();
    
    // ES6的写法
    const obj4 = {
        run(){
            console.log('obj4run');
        },
        eat(){
            console.log('obj4eat');
        }
    }
    obj4.run();
    obj4.eat();
</script>
</body>
</html>